<!DOCTYPE HTML>
<html lang="en">
<head>
<title>ListLines - Syntax &amp; Usage | AutoHotkey</title>
<meta name="description" content="The ListLines command displays the script lines most recently executed." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>ListLines</h1>

<p>Displays the script lines most recently executed.</p>

<pre class="Syntax"><span class="func">ListLines</span> <span class="optional">, OnOff</span></pre>
<h2>Parameters</h2>
<dl>

  <dt>OnOff</dt>
  <dd><p>If blank or omitted, the history of lines most recently executed is shown. <span class="ver">[v1.0.48.01+]</span>: An optional first parameter was added, which can be either On or Off. It affects only the behavior of the <a href="../misc/Threads.htm">current thread</a> as follows:</p>
      <p><strong>On</strong>: Includes subsequently-executed lines in the history. This is the starting default for all scripts.</p>      
      <p><strong>Off</strong>: Omits subsequently-executed lines from the history.</p>
      <p><span class="ver">[v1.1.30+]:</span> The decimal values 1 and 0 may be used in place of On and Off, respectively.</p>
      </dd>

</dl>

<h2>Remarks</h2>
<p>ListLines (with no parameter) is equivalent to selecting the &quot;View-&gt;Lines most recently executed&quot; menu item in the main window. It can help <a href="../Scripts.htm#debug">debug a script</a>.</p>
<p><code>ListLines Off/On</code> can be used to selectively omit some lines from the history, which can help prevent the history from filling up too quickly (such as in a loop with many fast iterations). <code>ListLines Off</code> may also improve performance by a few percent.</p>
<p>Every newly launched <a href="../misc/Threads.htm">thread</a> (such as a <a href="../Hotkeys.htm">hotkey</a>, <a href="Menu.htm">custom menu item</a>, or <a href="SetTimer.htm">timed</a> subroutine) starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part of the script).</p>
<p><span class="ver">[v1.1.28+]:</span> The built-in variable A_ListLines contains 1 if ListLines is enabled and 0 otherwise.</p>
<p>On a related note, the built-in variables <a href="../Variables.htm#LineNumber">A_LineNumber</a> and <a href="../Variables.htm#LineFile">A_LineFile</a> contain the currently executing line number and the file name to which it belongs.</p>
<h2>Related</h2>
<p><a href="KeyHistory.htm">KeyHistory</a>, <a href="ListHotkeys.htm">ListHotkeys</a>, <a href="ListVars.htm">ListVars</a></p>
<h2>Examples</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>ListLines
ListLines Off</pre>
</div>

</body>
</html>
